<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>06自定义JS对象</title>
</head>
<body>
<table border="1px">
    <tr>
        <td>商品名称</td>
        <td>商品价格</td>
        <td>商品数量</td>
    </tr>
</table>
<script>
    let productArr = [
        {title:'小米14',price:8000,num:200},
        {title:'华为mate60',price:5000,num:100},
        {title:'苹果16',price:10000,num:700},
        {title:'魅族',price:2530,num:600},
    ];
        console.log(productArr);
        let tableE = document.querySelector('table');
       for (let i = 0; i < productArr.length; i++){
           let trE = document.createElement('tr');
           let titleTd = document.createElement('td');
           let priceTd = document.createElement('td');
           let numTd = document.createElement('td');

           titleTd.innerHTML = productArr[i].title;
           priceTd.innerHTML = productArr[i].price;
           numTd.innerHTML = productArr[i].num;

           trE.append(titleTd,priceTd,numTd);
           tableE.append(trE)
}
       let p1={
           name:'朱星百',
           age:25,
           say:function (){
               console.log('我是'+this.name+'今年'+this.age+'岁');
           }
       }
       console.log(p1);
       p1.say();


       let p2={}
           p2.name='季煜诗'
           p2.age=23
           p2.say = function (){
               console.log('我是'+this.name+'今年'+this.age+'岁');
           };
           console.log(p2);
           p2.say();
</script>
</body>
</html>